package ling.common;

import cn.hutool.core.util.ArrayUtil;
import com.ruoyi.common.constant.Constants;
import com.ruoyi.common.core.domain.model.LoginUser;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.framework.security.context.PermissionContextHolder;
import com.ruoyi.framework.web.service.PermissionService;
import lombok.experimental.Delegate;
import lombok.var;
import org.apache.commons.lang3.ArrayUtils;
import org.springframework.context.annotation.Primary;
import org.springframework.core.annotation.Order;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Set;

@Primary
@Service("ps")
public class PowerService  extends PermissionService{

//    @Delegate
//    PermissionService permissionService=new PermissionService();


    public boolean any(String ...permissions) {
        if (permissions.length < 1) {
            return false;
        }
        var str = String.join(Constants.PERMISSION_DELIMETER, Arrays.asList(permissions));
        //return true;
        return hasAnyPermi(str);
    }
}
